//
// Created by chizuru on 2025/9/4.
//

#pragma once
#include <string>

enum class ErrorCode {
    OK = 0,
    IOError,
    Unsupported,
    CommandFailure,
    ReadFailure,
    WriteFailure,
    RollbackFailure,
    Cancelled,
    InvalidArgument,
    InvalidAddress,
    Timeout,
    ConnectionFailure,
    CloseFailure,
    Unknown
};
struct OperationResult{
    bool success = true;
    ErrorCode code = ErrorCode::OK;
    std::string message;

    static OperationResult Ok(const std::string& message = "") { return {true, ErrorCode::OK, message};}
    static OperationResult Fail(ErrorCode code, const std::string& message = "") { return {false, code, message};}

};
